package com.ffs.persist.utils;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 线程池工具
 *
 * @author ffs80
 */
public class ExecutorUtil {

    /**
     * 场景定时线程池
     */
    public static final ScheduledExecutorService SCENE_TIMER = Executors.newScheduledThreadPool(4, new ThreadFactory() {
        final AtomicInteger count = new AtomicInteger(0);

        @Override
        public Thread newThread(Runnable r) {
            int curCount = count.incrementAndGet();
            return new Thread(r, "SCENE_TIMER-" + curCount);
        }
    });
}
